package com.five.zhh.fiveinfive.room.message;

import com.five.zhh.fiveinfive.room.message.result.DefaultResult;
import com.five.zhh.fiveinfive.room.user.UserInfoInRoom;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 各个操作对应的响应内容
 */

@Data
public class UserOperateResult {

    /**
     * 对应的操作类型
     */
    protected OperateTittle tittle;

    /**
     * 操作请求的发送者，也是响应的目标
     */
    protected UserInfoInRoom receiver;

    protected String roomCode;

    protected String message;

    private final LocalDateTime time = LocalDateTime.now();

    public UserOperateResult() {
        this.tittle = OperateTittle.DEFAULT;
    }

    public UserOperateResult(OperateTittle tittle) {
        this.tittle = tittle;
    }
    public UserOperateResult(OperateTittle tittle, String roomCode) {
        this.tittle = tittle;
        this.roomCode = roomCode;
    }

    public UserOperateResult(OperateTittle tittle, String roomCode, String message) {
        this.tittle = tittle;
        this.roomCode = roomCode;
        this.message = message;
    }

    public static UserOperateResult defaultResult(OperateTittle tittle, String roomCode) {
        return new DefaultResult(tittle, roomCode, "响应成功");
    }
}
